<template>
  <nav class="navbar">
    <div class="navbar-container">
      <ul class="navbar-menu">
        <li><router-link to="/agriculture">农业资讯</router-link></li>
        <li><router-link to="/government">政务公开</router-link></li>
        <li><router-link to="/wenchuang/">文创展示</router-link></li>
        <!-- <router-view></router-view> -->
        <li class="empty-box"><img src="./images/title3.png" alt="" /></li>
        <li><router-link to="/interaction">互动平台</router-link></li>
        <li><router-link to="/data">数据发布</router-link></li>
        <li><router-link to="/green" style="color: green">绿水青山</router-link></li>
        <el-button type="success" round @click="goLogin">登录/注册</el-button>
        <!-- <div class="search-box">
                    <input type="text" class="search-txt" placeholder="搜索一下" />
                </div> -->
      </ul>
    </div>
  </nav>
</template>

<script>
export default {
  name: "MyHeader",
  methods:{
    goLogin(){
        this.$router.push('/login')
    }
  }
};
</script>

<style lang="less" scoped>
.navbar {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 80px;
  background-color: #fff;
  box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 10px;
}

.navbar-container {
  display: flex;
  justify-content: space-between;
  /* 保持原有元素间的间距 */
  /* justify-content: center; */
  align-items: center;
  width: 1053px;
  margin: 0 auto;
}

.logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 20px;
}

.navbar-menu {
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.navbar-menu li {
  margin: 0 20px;
}

.navbar-menu li a {
  position: relative;
  text-decoration: none;
  color: #000;
  font-size: large;
  font-weight: bold;
  text-align: center;
}

.navbar-menu li a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background-color: transparent;
  transition: background-color 0.3s;
}

.navbar-menu li a:hover::after,
.navbar-menu li a.active::after {
  background-color: green;
}

.empty-box {
  width: 232px;
  height: 156px;
  margin-top: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.empty-box img {
  max-width: 245%;
  max-height: 73%;
  object-fit: contain;
}

</style>